#include "messagebox.h"

MessageBox::MessageBox(const QString &message, QWidget *parent)
    : QDialog(parent)
    , messageLabel(new QLabel(message, this))
{
    confirmButton = new QPushButton("确认", this);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(messageLabel);
    layout->addWidget(confirmButton);
    setLayout(layout);

    connect(confirmButton, &QPushButton::clicked, this, &MessageBox::onConfirmClicked);

    adjustSize();
}

void MessageBox::onConfirmClicked()
{
    accept();
}
